#ifndef ADDUPDATEDIALOG_H
#define ADDUPDATEDIALOG_H

#include <QDialog>
#include <QMap>

#include <Xml/XmlPath.h>

struct DialogModels
{
    DialogModels() : mInitialized(false) {}
    virtual ~DialogModels() {}
    bool mInitialized;
};

class TitledData;
class QMainWindow;

class AddUpdateDialog : public QDialog
{
    Q_OBJECT
public:
    AddUpdateDialog(const XmlPath &path, QWidget *parent = 0);
    virtual ~AddUpdateDialog();
    virtual TitledData *data() = 0;
    XmlPath xmlPath() const { return mXmlPath; }
    void setXmlPath(const XmlPath &path) { mXmlPath = path; }
    void initialize();
Q_SIGNALS:
    void statusMessage(const QString &);
    void dataUpdated();
protected:
    void setDirty(bool dirty) { mChangesMade = dirty; }
    virtual void loadData() = 0;
    virtual void saveData() = 0;
    virtual void setupData() = 0;
    virtual void clearData() = 0;
protected Q_SLOTS:
    void on_buttonBox_accepted();
    void on_addAnotherPushButton_clicked();
private:
    void saveXml();
    XmlPath mXmlPath;
    bool mChangesMade;
};

#endif // ADDUPDATEDIALOG_H
